package gew.data;

import java.sql.ResultSet;
import java.sql.SQLException;

public class TradeTopNPartnersDataItem {

    private final static int PERIOD_ID = 1;
    private final static int PARTNER_ID = 2;
    private final static int VALUE = 3;
    private final static int RANK = 4;
    private final static int VALUE_STR = 5;
    private final static int SHARE_STR = 6;

    public final static TradeTopNPartnersDataItem EMPTY = new TradeTopNPartnersDataItem(null, null, null, null, "", "");

    private final Integer periodId;
    private final Integer partnerId;
    private final Long value;
    private final Integer rank;
    private final String valueStr;
    private final String shareStr;

    public TradeTopNPartnersDataItem(Integer periodId, Integer partnerId, Long value, Integer rank, String valueStr, String shareStr) {
        this.periodId = periodId;
        this.partnerId = partnerId;
        this.value = value;
        this.rank = rank;
        this.valueStr = valueStr;
        this.shareStr = shareStr;
    }

    public TradeTopNPartnersDataItem(ResultSet rs) throws SQLException {
        this.periodId = rs.getInt(PERIOD_ID);
        this.partnerId = rs.getInt(PARTNER_ID);
        this.value = rs.getLong(VALUE);
        this.rank = rs.getInt(RANK);
        this.valueStr = rs.getString(VALUE_STR);
        this.shareStr = rs.getString(SHARE_STR);
    }

    public Integer getPeriodId() {
        return periodId;
    }

    public Integer getPartnerId() {
        return partnerId;
    }

    public Long getValue() {
        return value;
    }

    public Integer getRank() {
        return rank;
    }

    public String getValueStr() {
        return valueStr;
    }

    public String getShareStr() {
        return shareStr;
    }

}
